﻿using UnityEngine;
using System.Collections;

public class CloudKiller : MonoBehaviour {

	Transform leftTrans;
	//float timeAwake = 10f;
	//Vector3 velocity = Vector3.zero;
	//bool setSleeping = false;
	// Use this for initialization
	void Start () {
		this.leftTrans = GameObject.Find ("LeftWall").transform;
	}
	
	// Update is called once per frame
	void Update () {
		/*
		if (timeAwake >= 0f) {
			timeAwake -= Time.deltaTime;
		} else {
			/*
			if (!setSleeping) {
				velocity = this.gameObject.rigidbody2D.velocity;
				this.gameObject.rigidbody2D.isKinematic = true;
				this.gameObject.rigidbody2D.Sleep();
				setSleeping = true;
			}
			else {
				this.transform.position += velocity / 50f;
			}
			*/
		//}
	}

	void FixedUpdate() {
		if (this.leftTrans == null) {
			this.leftTrans = GameObject.Find ("LeftWall").transform;
		}
		if (this.transform.position.x < this.leftTrans.position.x) {
			GameObject.Destroy(this.gameObject);
		}
	}

}
